public class InitailTelephone {

    static void print(){
        System.out.println("我是静态方法！");
    }

    static float weight;
    float width;

    public static void main(String[] args) {
        Telephone phone = new Telephone();

//        phone.sendMessage();

        phone.screen = 5.0f;
        phone.cpu = 1.4f;
        phone.mem = 2.0f;


        phone.sendMessage();
        System.out.println("通过类名访问hobby "+Telephone.hobby);


        Telephone phone2 = new Telephone(5.6f, 23.4f, 2);
        phone2.sendMessage();

//        Telephone.hobby("aaaaa");
        phone2.hobby("aklsjdgkaskl");
        System.out.println("通过对象名访问hobby "+phone2.hobby);
        System.out.println("通过对象名phone访问hobby "+phone.hobby);



        //调用本类的方法
        InitailTelephone.print();
        //print();//同上
        InitailTelephone init = new InitailTelephone();
//        init.print();//推荐是用类名调用静态方法


        System.out.println("静态方法可以调用静态变量 "+ weight);
//        System.out.println("静态不能调用非静态变量 "+ width);//报错

        init.can();

    }

    public void can(){
        System.out.println("普通方法可以调用静态变量 "+ weight);
        System.out.println("普通方法也可以调用非静态变量 "+ width);
    }
}
